class Hurt extends Action {
	constructor(enity, callback) {
		super();

		this.enity = enity;
		this.enity.state = "hit";
        this.callback = callback;
	}

	update() {
		const speed = (Math.abs(this.enity.body.velocity.x) + Math.abs(this.enity.body.velocity.y)) / 2;
		if(speed<this.enity.speed/2) {
			this.enity.action = null;
			this.enity.state = "idea";
            this.callback(this);
		}
	}
}